//package com.zhanghe.study.springboot.controller;
//
//import com.zhanghe.study.springboot.model.Department;
//import com.zhanghe.study.springboot.model.Role;
//import com.zhanghe.study.springboot.model.User;
//import com.zhanghe.study.springboot.repository.DepartmentRepository;
//import com.zhanghe.study.springboot.repository.RoleRepository;
//import com.zhanghe.study.springboot.service.UserService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
//@RestController
//@RequestMapping(value = "/cache")
//public class CacheController {
//    @Autowired
//    private UserService userService;
//    @Autowired
//    private DepartmentRepository departmentRepository;
//    @Autowired
//    private RoleRepository roleRepository;
//
//    @RequestMapping(value = "/id")
//    public Object add(){
//        Department department = new Department();
//        department.setName("IT部");
//        departmentRepository.save(department);
//
//        Role role = new Role();
//        role.setName("admin");
//        roleRepository.save(role);
//
//        List<Role> roles = new ArrayList<>();
//        roles.add(role);
//        User user = new User();
//        user.setName("张三");
//        user.setCreatedate(new Date());
//        user.setDepartment(department);
//        user.setRoles(roles);
//        userService.create(user);
//
//        return user;
//    }
//}
